<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 列出1~10000的所有质数。</title>
</head>
<body>
    <script>
        for (var n = 1 ; n <= 10000; n++) {
            var total = 0;
            for (var i = 1 ; i <= n; i++){
                if (n % i === 0) {
                    total++
                }
            }
            if (total === 2) {
                console.log(n)
            } 
        }
    </script>
</body>
</html>